package com.api.shopapi.mapper;


import com.api.shopapi.entity.TotalOrderDay;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface TotalOrderDayMapper {


    @Insert("insert into total_order_day" +
            "(" +
            "TotalOrderDayCode,"+
            "Year,"+
            "Month,"+
            "Day,"+
            "OrderCount,"+
            "OrderMoney,"+
            "CreateTime,"+
            "BusinessCode"+
            ")" +
            "values" +
            "(" +
            "#{totalOrderDay.TotalOrderDayCode}," +
            "#{totalOrderDay.Year}," +
            "#{totalOrderDay.Month}," +
            "#{totalOrderDay.Day}," +
            "#{totalOrderDay.OrderCount}," +
            "#{totalOrderDay.OrderMoney}," +
            "#{totalOrderDay.CreateTime}," +
            "#{totalOrderDay.BusinessCode}" +
            ")")
    int insert(@Param("totalOrderDay") TotalOrderDay totalOrderDay);

    @Select("select * from total_order_day" +
            " where month=#{month}" +
            " and businessCode=#{businessCode} order by CreateTime asc")
    List<TotalOrderDay> ListThisMonth(@Param("businessCode") String businessCode,
                                      @Param("month") String month);




}
